﻿using Simulation.Framework;
using UnityEngine.Events;
using UnityEngine.UI;
using UnityEngine;
using System.Collections.Generic;
using System.Collections;

namespace Easy.Game2d {

    public partial class UIStartPanel : PanelBase {

        public UnityEngine.RectTransform ContentRectTransform{get;private set;}

        public TMPro.TextMeshProUGUI ContentTextTextMeshProUGUI{get;private set;}

        public UnityEngine.EventSystems.EventTrigger BGEventTrigger{get;private set;}

        public UnityEngine.UI.ScrollRect TextScrollViewScrollRect{get;private set;}

        #region control
        private void InitComponent() {
            // init
            ContentRectTransform = transform.Find("BG/TextScrollView/Viewport/Content").GetComponent<UnityEngine.RectTransform>();
            ContentTextTextMeshProUGUI = transform.Find("BG/TextScrollView/Viewport/Content/ContentText").GetComponent<TMPro.TextMeshProUGUI>();
            BGEventTrigger = transform.Find("BG").GetComponent<UnityEngine.EventSystems.EventTrigger>();
            TextScrollViewScrollRect = transform.Find("BG/TextScrollView").GetComponent<UnityEngine.UI.ScrollRect>();

            // button
            TextScrollViewScrollRect.onValueChanged.RemoveAllListeners();
            TextScrollViewScrollRect.onValueChanged.AddListener(OnTextScrollViewScrollRectValueChanged);
        }

        private void ClearComponent() {
            // button
            TextScrollViewScrollRect?.onValueChanged.RemoveAllListeners();

            // clear
            ContentRectTransform = null;
            ContentTextTextMeshProUGUI = null;
            BGEventTrigger = null;
            TextScrollViewScrollRect = null;
        }
        #endregion

        private void OnTextScrollViewScrollRectValueChanged(UnityEngine.Vector2 arg0) {
        }
    }
}
